package com.chexiehui.jc.ui.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.chexiehui.jc.R;
import com.chexiehui.jc.adapter.FragmentViewPagerAdapter;
import com.chexiehui.jc.base.BaseActivity;
import com.chexiehui.jc.ui.fragment.BrowseHistoryForumFragment;
import com.chexiehui.jc.ui.fragment.BrowseHistoryPostsFragment;
import com.chexiehui.jc.ui.fragment.BrowseHistorySeriesFragment;
import com.chexiehui.jc.ui.fragment.MyCollectionForumFragment;
import com.chexiehui.jc.ui.fragment.MyCollectionPostsFragment;
import com.flyco.tablayout.SlidingTabLayout;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * 我的收藏
 */
public class MyCollectionActivity extends BaseActivity {

    @BindView(R.id.stl_action_table)
    SlidingTabLayout stlActionTable;
    @BindView(R.id.vp_action_pager)
    ViewPager vpActionPager;

    private String[] titles = new String[]{"论坛", "帖子"};
    private ArrayList<Fragment> actionFragmentList = new ArrayList<>();

    @Override
    protected void setTitleBar() {
        titleBar.setTitleMainText("我的收藏");
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_my_collection;
    }

    @Override
    protected void initView(Bundle var1) {
        vpActionPager.setOffscreenPageLimit(titles.length);
        actionFragmentList.add(MyCollectionForumFragment.getInstance());
        actionFragmentList.add(MyCollectionPostsFragment.getInstance());
        vpActionPager.setAdapter(new FragmentViewPagerAdapter(getSupportFragmentManager(), actionFragmentList, titles));
        stlActionTable.setViewPager(vpActionPager);
    }
}
